
#include "gtkMenu.h"

void ajoutNouveaux(GtkMenuItem *menuitem,gpointer user_data)
{
  GtkPrincipal *principal = user_data;
  creer_GAjo(NULL, principal);
  (void)menuitem;
  (void)user_data;
}

void toggled_hide(GtkButton *widget, gpointer user_data)
{
  GtkInfo * pane = user_data;
  gtk_widget_set_visible(getContainer(pane),!gtk_widget_get_visible(getContainer(pane)));
  (void)widget;
}

GtkWidget * creer_GMen(GtkPrincipal *principal)
{
  GtkWidget *menu;
  
  GtkWidget *menuFichier, *menuItemFichier, *subFermer;
  GtkWidget *menuEdition, *menuItemEdition, *subNouveaux;
  GtkWidget *menuAffichage, *menuItemAffichage, 
    *subCacher;
  GtkWidget *menuAide, *menuItemAide;
  
  menu = gtk_menu_bar_new();
  
  menuFichier = gtk_menu_new();
  menuEdition = gtk_menu_new();
  menuAffichage = gtk_menu_new();
  menuAide = gtk_menu_new();
  
  menuItemFichier = gtk_menu_item_new_with_label("Fichier");
  menuItemEdition = gtk_menu_item_new_with_label("Edition");
  menuItemAffichage = gtk_menu_item_new_with_label("Affichage");
  menuItemAide = gtk_menu_item_new_with_label("Aide");
  subFermer = gtk_image_menu_item_new_from_stock(GTK_STOCK_CLOSE, NULL);
  subNouveaux = gtk_image_menu_item_new_from_stock(GTK_STOCK_ADD, NULL);

  subCacher = gtk_image_menu_item_new_from_stock(GTK_STOCK_INFO, NULL);
  
  gtk_menu_shell_append(GTK_MENU_SHELL(menuFichier), subFermer);

  gtk_menu_shell_append(GTK_MENU_SHELL(menuEdition), subNouveaux);

  gtk_menu_shell_append(GTK_MENU_SHELL(menuAffichage), subCacher);
  gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuItemFichier);
  gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuItemEdition);
  gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuItemAffichage);
  gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuItemAide);

  gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuItemFichier), menuFichier);
  gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuItemEdition), menuEdition);
  gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuItemAffichage), menuAffichage);
  gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuItemAide), menuAide);

  g_signal_connect(subNouveaux, "activate", G_CALLBACK (ajoutNouveaux), principal);
  g_signal_connect(subCacher, "activate", G_CALLBACK(toggled_hide), principal->ginfo);
  return menu;
}
